#!/user/bin/env node

const log = console.log,
      http = require('http');

http.createServer((req,res)=>{
  log('http request method:',req.method);
  switch(req.method){
    case 'GET':
      //select(req,res);
      log(res.end(req.method));
      break;
    case 'POST':
     // create(req,res);
      log(res.end(req.method));
      break;
    case 'PUT':
      //update(req,res);
      log(res.end(req.method));
      break;
    case 'DELECT':
      //remove(req,res);
      log(res.end(req.method));
      break;
    default:
      res.end('something wrong');
  }
}).listen(8080);

/*function select(res,req){
  res.end(req.method);
}
function create(res,req){
  res.end(req.method);
}
function update(res,req){
  res.end(req.method);
}
function remove(res,req){
  res.end(req.method);
}*/
